Question 1

Question 2

Question 3

The dataset WorldMarkts99 20.RDS contains price history from 1999/01/01 to 2020/04/30 of 11 market indices worldwide plus VLIC and VIX. The objective of this exercise is to analyze the relationship between the returns and the volatility of this indices as it has been frequently observed that US markets leads other developed markets in Europe or Asia, and that at times the leader becomes the follower. In other words, it has been observed that the return of some indices behave like other asset´s returns of completely the opposite. To do so we will conduct a casual analysis utilizing granger causality in a specific time frame (from 07-2001 to 06 -200)

To initialize the analysis we must note that the series contains missing data as it can be observed in the plot below.

The first step in our analysis in to impute the missing data in the daily prices series. To do so we will employ the ‘ImputeTS’ library, a library specialized in time series imputation. As we are trying to impute data points between known data points in a series we will utilize the interpolation method of imputation. For this specific case we will use linear interpolation which is achieved by geometrically rendering a straight line between two adjacent points on a graph or plane. Having this values imputed in the daily series we can now calculate the monthly and weekly logarithmic returns of the series.

After having calculated the periodic returns of the series we can initialize the causality analysis. To do so we use the granger.test function from the ‘MSBVAR’ library. The table below shows the causality analysis for the first four lags of the returns of these indices, note that the cause -> effect analysis goes from row to column. The binary variable corresponds to causality, that is 1 if X causes Y (p-value is less than 0.05) and 0 otherwise.

Monthly Causality of the Returns
BSESN BVSP FTSE GDAXI GSPC HSCE IBEX JKSE MXX N225 TWII VIX VLIC
BSESN 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 1, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0
BVSP 0, 0, 0, 0 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 1, 1 0, 0, 0, 0 1, 1, 1, 1 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 1 1, 0, 0, 0 0, 0, 0, 0
FTSE 0, 0, 0, 0 0, 0, 0, 0 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 1, 1 0, 0, 0, 0 1, 1, 1, 0 0, 0, 0, 0 0, 0, 0, 0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, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 1, 1, 1, 1 0 0, 0, 0, 1
VLIC 0, 1, 0, 0 1, 1, 1, 1 1, 1, 1, 0 0, 0, 0, 0 0, 0, 0, 0 0, 0, 0, 0 0, 1, 1, 0 0, 0, 1, 1 0, 0, 0, 0 0, 0, 0, 0 1, 1, 1, 0 0, 0, 0, 0 0

What we see in the causality of the returns that the majority of the return of the indices are not caused by other indices. However in the case of the JKSE (Jakarta Composite Index) we observe that its monthly returns are caused by the returns of the indices of other economies. This is also an observable behavior in the HSCE (Hang Seng China Enterprises Index) where its monthly returns in larger lags can be explained by other indices. In an economic sense, this is a logical behavior where we see leader economies and followers, in this case we would consider both the JKSE and the HSCE followers of indices in stronger economies and do not follow each other as it can be see in the causality of one another. This leader-follower behaviour is more evident in weekly returns, hence in a short term

Monthly Causality of the Volatilities
BSESN BVSP FTSE GDAXI GSPC HSCE IBEX JKSE MXX N225 TWII VIX VLIC
BSESN 0 0, 1, 1, 1 0, 0, 1, 1 0, 1, 1, 1 0, 0, 0, 0 0, 0, 0, 0 0, 1, 1, 1 0, 0, 0, 0 0, 1, 1, 0 0, 0, 1, 1 0, 1, 1, 1 0, 0, 0, 0 0, 0, 0, 0
BVSP 0, 0, 1, 1 0 0, 0, 0, 0 1, 0, 1, 1 0, 0, 0, 0 0, 1, 1, 1 0, 0, 1, 1 0, 0, 0, 0 0, 1, 0, 0 1, 1, 1, 1 1, 1, 1, 0 0, 0, 1, 0 1, 0, 1, 0
FTSE 0, 1, 1, 1 0, 1, 1, 1 0 1, 1, 1, 1 1, 0, 1, 1 0, 1, 1, 1 1, 0, 1, 1 0, 1, 1, 1 0, 1, 1, 1 1, 1, 1, 1 1, 1, 1, 1 0, 1, 1, 1 0, 1, 1, 1
GDAXI 0, 1, 1, 1 0, 0, 1, 1 1, 1, 1, 1 0 1, 1, 1, 0 0, 1, 1, 1 1, 1, 1, 1 0, 1, 1, 1 0, 1, 1,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, 1, 1, 1 1, 1, 1, 1 1, 1, 1, 1 1, 1, 1, 0 1, 0, 0, 0 1, 1, 1, 1 1, 1, 1, 1 1, 0, 1, 1 0

Regarding volatility spill over, here we see the transmission of instability from market to market. Its is very clear from the causality results that markets are truly interconnected therefore in both short and medium term the instability from one market is transmitted to others.

Question 4

For this exercise we sampled 5 different functions for 200 point between -10 and 10 from a latent Gaussian process prior:

\[ f \sim \mathcal{N}(0,K) \]

where K is the covariance matrix. We will sample these five functions using the 4 kernels with various parameters.

Squared Exponential Kernel

\[k_{se}(\mathbf{x,x'}) = h^2 (\frac{\mathbf{(x,x')}^2}{\lambda^2}) \text{for} \quad h=1; \lambda = 0.1,1,10 \]

The functions are plotted below. The hyper parameter \(\lambda\) describes the variance which determines the average distance of the data-generating function from its mean. Hence the smaller the value the higher the larger distance from its mean and large \(\lambda\) value create smoother functions

Rational Quadratic Kernel

\[k_{rq}(\mathbf{x,x'}) = h^2(1+\frac{(\mathbf{x-x'})^2}{\alpha \lambda^2})^{-\alpha} \quad \text{for,}\quad h=1; \lambda = 0.1,1,10; \alpha = 1,5,10\]

This kernel is equivalent to summing over infinitely many squared exponential kernels. Hence, GP priors with this kernel are expected to see functions which vary smoothly across many length scales. When we compare the plots for $\alpha$ = 1 we see that variability of the data is higher than the comparable plots in the squared exponential kernel. The behavior of $\lambda$ is very similar to the squared exponential kernel, however as it multiplied by $\alpha$ we expect to see and exageration in this behavior.

The change in the variability introduced by $\lambda$ in the kernel is maximized by the hyper parameter $\alpha$. Hence for larger values of $\alpha$ there is an obvious increase in the distance of the points from its mean for small values of $\lambda$.

Periodic Kernel

\[ k_{3}(\mathbf{x,x'}) = 2exp(\frac{-sin(\pi(\mathbf{x-x'})/3)^2}{2 \lambda^2})+1.5\mathbf{xx'}, \quad \text{for} \quad h= 1,\lambda = 0.1,1,10 \]

Once again the hyperparameter \(\lambda\) introduces the variability of the series. The lower the value the more distance and rate of change in the values we see in our function. However, interestingly in this kernel we see that for smoother function there is a periodic pattern repeated, this pattern is very clear for \(\lambda = 10\). This pattern is introduced by the sin function. The distance between repetitions is in this specific case 3

Fourth Kernel

\[ k_{4}(\mathbf{x,x'}) = 2exp(\frac{\mathbf{x-x'}^2}{2 \lambda^2})+1.5\mathbf{xx'}, \quad \text{for} \quad h= 1,\lambda = 0.1,1,10 \]

This fourth kernel is a combination of a periodic kernel and a linear. While the periodic kernel is responsible for the distance of the points form its mean, the linear kernel is responsible for the trend of the function, hence this is not a stationary kernel. However we see a very similar pattern in the hyperparameter \(\lambda\)

Question 6